package com.sweet.fourtimeoa.interceptor;

import com.sweet.fourtimeoa.mapper.SystemMapper;
import com.sweet.fourtimeoa.pojo.entity.OperationLogs;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

@Component
public class LogInterceptor  implements HandlerInterceptor {

    @Autowired
    private SystemMapper systemMapper;
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        OperationLogs logs = new OperationLogs();
        logs.setUserId(1);
        systemMapper.addLog(logs);
        return true;
    }
}
